/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.tgsoft.gfrm.modules.sys.service;

import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.tgsoft.gfrm.sys.dao.SysUserMapper;
import com.tgsoft.gfrm.sys.entity.SysUser;

import org.springframework.beans.factory.annotation.Autowired;


/**
 * @author gacl
 * 使用@Service注解将UserServiceImpl类标注为一个service
 * service的id是userService
 */
@Service("userService")
public class UserService  {

    /**
     * 使用@Autowired注解标注userMapper变量，
     * 当需要使用UserMapper时，Spring就会自动注入UserMapper
     */
    @Autowired
    private SysUserMapper userMapper;//注入dao

  
    public void addUser(SysUser user) {
        userMapper.insert(user);
    }

   
    public SysUser getUserById(String userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

   
    public List<SysUser> getAllUser() {
        return userMapper.selectAll();
    }


    
   /****
    * 查找登录名
    * @param username
    * @return
    */
	public SysUser findByLoginName(String username) {
		SysUser u=new SysUser(); 
		u.setLoginName(username);
		return userMapper.selectOne(u);
	
	}
    
}